module Version;

import tango.io.Stdout;

struct Version{
	char[][] added;
	char[][] delated;
	char[][] modyfied;
	
	bool isEmpty(){
		return added.length==0 && delated.length==0 && modyfied.length==0;
	}
	
	void addA(char[] file){
		added~=file.dup;
	}
	
	void addM(char[] file){
		modyfied~=file.dup;
	}
	
	void addD(char[] file){
		delated~=file.dup;
	}
	
	Version* clone(){
		Version v;
		foreach(a;added) v.addA(a);
		foreach(m;modyfied) v.addM(m);
		foreach(d;delated) v.addD(d);
		auto vp = new Version;
		vp = &v;
		return vp;
	}
	
	void clean(){
		added.length=0;
		modyfied.length=0;
		delated.length=0;
	}
	
	void writeVersion(){
		Stdout.format ("Modyfied:\n");
		foreach(m;modyfied) Stdout.format ("{}\n", m);
		Stdout.format ("Added:\n");
		foreach(a;added) Stdout.format ("{}\n",a);
		Stdout.format ("Delated:\n");
		foreach(d;delated) Stdout.format ("{}\n", d);
	}
}